﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 运算符和表达式01
{
    class Program
    {
        static void Main(string[] args)
        {
            // 算术运算符 +、-、*、/、%、++、--
            // 赋值运算符
            int a = 10;     //将10赋给a，不是a等于10
            int b = 15;
            int c = a + b;  // 将a+b的值赋给c
            int d = a - b;
            int e = a * b;
            double f = a / b; //商为0，是有int类型的0转换为double类型的0
            int g = a % b;

            // 两数相除，要想出现浮点数，那么这两个数必须至少有一个是浮点数，否则，商为整数
            double a1 = 10;
            int b1 = 15;
            double c1 = a1 / b1;
            //Console.WriteLine(c1);

            //Console.WriteLine("c = {0}, d = {1}, e = {2}, f = {3}, g = {4}", c, d, e, f, g);

            //num1++, ++num等同于 num1 = num1 + 1

            int num1 = 1;
            int num3 = 1;
            int num2;
            //num2 = num1++;    //先给num2赋值，然后num1自增
            num2 = ++num1;      //num1先自增，然后给num2赋值
            Console.WriteLine("num2 = {0}", num2);
            Console.WriteLine("num1++ {0}", num1++);
            Console.WriteLine("++num3 {0}", ++num3);

            int count1 = 3;
            int count2 = 0;
            //count2 = count1++;
            //count1 = 4? count2 = 3?

            count2 = ++count1;
            //couny1 = 4? count2 = 4?
            Console.WriteLine(count1);
            Console.WriteLine(count2);


        }
    }
}
